package com.example.test.启动线程.高并发容器;

import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public class WriteTask implements Runnable {

    private DRDictionary drDictionary;

    public WriteTask(DRDictionary drDictionary) {
        this.drDictionary = drDictionary;
    }

    @Override
    public void run() {
        int i = 0;
        while (true) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            String name = Thread.currentThread().getName();
            drDictionary.put("人人都是程序员", name +"---"+ i++);
        }
    }
}
